﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Brainee.Immutable
{
  public static class Extensions
  {
    static public IStack<T> Reverse<T> (this IStack<T> stack)
    {
      IStack<T> r = Stack<T>.Empty;
      for (IStack<T> f = stack; !f.IsEmpty; f = f.Pop ())
        r = r.Push (f.Peek ());
      return r;
    }
  }
}
